package types

// SeckillRequest 秒杀请求
type SeckillRequest struct {
	VoucherId string `json:"voucher_id" binding:"required"`
}

// CreateVoucherRequest 创建优惠券请求
type CreateVoucherRequest struct {
	VoucherId string  `json:"voucher_id" binding:"required"`
	Stock     int     `json:"stock" binding:"required,min=1"`
	Amount    float64 `json:"amount" binding:"required,min=0"`
	Title     string  `json:"title" binding:"required,max=255"`
	BeginTime string  `json:"begin_time" binding:"required"`
	EndTime   string  `json:"end_time" binding:"required"`
}

// UpdateVoucherRequest 更新优惠券请求
type UpdateVoucherRequest struct {
	Stock     *int     `json:"stock,omitempty" binding:"omitempty,min=0"`
	Amount    *float64 `json:"amount,omitempty" binding:"omitempty,min=0"`
	Title     *string  `json:"title,omitempty" binding:"omitempty,max=255"`
	BeginTime *string  `json:"begin_time,omitempty"`
	EndTime   *string  `json:"end_time,omitempty"`
}

// ResetVoucherRequest 重置优惠券请求
type ResetVoucherRequest struct {
	Stock int `json:"stock" binding:"required,min=1"`
}

// PaginationRequest 分页请求
type PaginationRequest struct {
	Page     int `form:"page" binding:"omitempty,min=1"`
	PageSize int `form:"page_size" binding:"omitempty,min=1,max=100"`
}

// VoucherListRequest 优惠券列表请求
type VoucherListRequest struct {
	PaginationRequest
	Status string `form:"status" binding:"omitempty,oneof=upcoming active expired"`
}

// OrderListRequest 订单列表请求
type OrderListRequest struct {
	PaginationRequest
	Status *int8 `form:"status" binding:"omitempty,oneof=0 1 2 3"`
}
